package top.go2do.auth.business.captcha.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import top.go2do.auth.business.captcha.module.CaptchaResult;
import top.go2do.auth.business.captcha.service.CaptchaService;

/**
 * @Description
 * @Author xingyj
 * @CreateTime 2025/6/5 16:34
 */
@RequestMapping("/captcha")
@RestController
@Slf4j
public class CaptchaController {

    @Autowired
    private CaptchaService captchaService;

    @GetMapping("/htc")
    CaptchaResult getCaptcha() {
        // TODO: 防止客户端频繁获取图形验证码，导致captchaId占满内存
        return captchaService.generateAndSaveCaptcha();
    }

}
